import http from './http.js'
// 统一资源管理
export function ResourcePost(category, body) {
  return http({
    url: `/rest/${category}`,
    method: 'post',
    data: body
  })
}

export function ResourceGetAll(category) {
  return http({
    url: `/rest/${category}`,
    method: 'get'
  })
}

export function ResourceGetById(category, id) {
  return http({
    url: `/rest/${category}/${id}`,
    method: 'get'
  })
}

export function ResourceUpdate(category, id, body) {
  return http({
    url: `/rest/${category}/${id}`,
    method: 'put',
    data: body
  })
}

export function ResourceDelete(category, id) {
  return http({
    url: `/rest/${category}/${id}`,
    method: 'delete'
  })
}

export function GetCourseByParentCategory(id) {
  return http({
    url: `/get/courseById/${id}`,
    method: 'get'
  })
}

export function GetParentCateById(id) {
  return http({
    url: `/get/parentCate/${id}`,
    method: 'get'
  })
}

export function GetSecCate() {
  return http({
    url: '/get/secCate',
    method: 'get'
  })
}
